Description | : The `Get IP To Location` API is an HTTP `GET` request that returns the ISO country/region code for a given IP address. Developers can use this information to block or modify content based on the geographical location from which the application is accessed. |
Reference | : Link ¶ |
⚶ Changes
{ "#id": "Geolocation_GetIPToLocation", "Description": { "new": "\n\nThe `Get IP To Location` API is an HTTP `GET` request that returns the ISO country/region code for a given IP address. Developers can use this information to block or modify content based on the geographical location from which the application is accessed.", "old": "\n\nThe `Get IP To Location` API is an HTTP `GET` request that, given an IP address, returns the ISO country code from which that IP address is located. Developers can use this information to block or alter certain content based on geographical locations where the application is being viewed from." }, "Summary": { "new": "Use to get the ISO country/region code for a given IP address.", "old": "Use to get the ISO country code for a given IP address" }, "$parameters": [ { "#name": "x-ms-client-id", "Description": { "new": "Indicates the account intended for use with the Microsoft Entra ID security model. This unique ID for the Azure Maps account can be obtained from the [Azure Maps management plane Account API](/rest/api/maps-management/accounts). For more information on using Microsoft Entra ID security in Azure Maps, see [Manage authentication in Azure Maps](/azure/azure-maps/how-to-manage-authentication).", "old": "Specifies which account is intended for usage in conjunction with the Microsoft Entra ID security model. It represents a unique ID for the Azure Maps account and can be retrieved from the Azure Maps management plane Account API. To use Microsoft Entra ID security in Azure Maps see the following [articles](https://aka.ms/amauthdetails) for guidance." } } ], "$responses": { "200": { "$properties": { "countryRegion": [ { "#name": "isoCode", "Description": { "new": "The IP address's 2-character country or region code ([ISO 3166-1](https://www.iso.org/iso-3166-country-codes.html)). Note that IP addresses in ranges reserved for special purposes will return Null for country/region.", "old": "The IP Address's 2-character code [(ISO 3166-1)](https://www.iso.org/iso-3166-country-codes.html) of the country or region. Please note, IP address in ranges reserved for special purpose will return Null for country/region." } } ] } } } }
⚼ Request
GET:
/geolocation/ip/{format}
{
x-ms-client-id:
string
,
api-version:
string
,
format:
string
,
ip:
string
,
}
⚐ Response (200)
{
countryRegion:
{
,
isoCode:
string
,
}
ipAddress:
string
,
}
⚐ Response (default)
{
error:
}
{
,
code:
string
,
message:
string
,
target:
string
,
details:
[
]
,
{
,
code:
string
,
message:
string
,
target:
string
,
details:
[
,
string
,
]
additionalInfo:
}
[
]
,
{
,
type:
string
,
info:
object
,
}
additionalInfo:
}
[
]
,
{
,
type:
string
,
info:
object
,
}